<?php
/**
 * Created by PhpStorm.
 * User: pengyixing
 * Date: 18/8/30
 * Time: 22:37
 */

namespace app\admin\controller;


use app\admin\docx\AdminNavs;
use think\Controller;

class Common extends Controller
{
    protected $title = 'title';

    public function _initialize()
    {
    }

    /**
     * 获取后台导航
     */
    public function getNavs()
    {
        $json = AdminNavs::getAdminNavs(true);
        exit($json);
    }

    protected function setTitle($title='')
    {
        $this->title = $title;
        $this->assign('title',$title);
    }

    protected function diesuccess($des,$code=0,$data=[],$count=0)
    {
        header("Content-type: application/json");
        $data = [
            'code'=>$code,
            'msg'=>$des,
            'count'=>$count,
            'data'=>$data,
        ];
        exit(json_encode($data));
    }

    protected function dieerror($des,$code=1,$data=[],$count=0)
    {
        header("Content-type: application/json");
        $data = [
            'code'=>$code,
            'msg'=>$des,
            'count'=>$count,
            'data'=>$data,
        ];
        exit(json_encode($data));

    }

}